package org.example.intern.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.intern.entity.common.SysRoster;
import org.example.intern.mapper.SysRosterMapper;
import org.example.intern.service.ISysRosterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRosterServiceImpl extends ServiceImpl<SysRosterMapper, SysRoster> implements ISysRosterService {

    @Autowired
    private SysRosterMapper sysRosterMapper;


    @Override
    public List<SysRoster> selectByPage(Integer pageNum, Integer pageSize) {
        return sysRosterMapper.selectByPage(pageNum, pageSize);
    }

    @Override
    public Integer selectTotal() {
        return sysRosterMapper.selectTotal();
    }

    @Override
    public int deleteRoster(Integer id) {
        return sysRosterMapper.deleteById(id);
    }


    @Override
    public int insert_update(SysRoster sysRoster) {
        if (sysRoster.getId() == null) {
            return sysRosterMapper.insert(sysRoster);
        }
        else {
            return sysRosterMapper.updateById(sysRoster);
        }
    }
}
